package org.indt.scrum.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.indt.scrum.dao.WcbiDAO;
import org.indt.scrum.model.Wcbi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;

public class WcbiDAOImpl implements WcbiDAO{

	private HibernateTemplate hibernateTemplate;

	@Autowired
	public WcbiDAOImpl(SessionFactory sessionFactory) {
		this.hibernateTemplate = new HibernateTemplate(sessionFactory);
	}
	
	public void delete(Wcbi entity) {
		this.hibernateTemplate.delete(entity);	
	}

	@SuppressWarnings("unchecked")
	public List<Wcbi> listAll() {
		return this.hibernateTemplate.find("from Wcbi");
	}
	
	public Wcbi load(Integer id) {
		return (Wcbi) this.hibernateTemplate.load(Wcbi.class, id);
	}

	public void save(Wcbi entity) {
		this.hibernateTemplate.save(entity);
		
	}

	public void update(Wcbi entity) {
		
		this.hibernateTemplate.update(entity);
	}
}
